package com.test.map;

import java.util.concurrent.ConcurrentHashMap;

public class MCurrentHashMap implements Runnable{
	public static String n = new String("aaaa");
	public static void main(String[] args) throws InterruptedException {
		ConcurrentHashMap<String, Object> map = new ConcurrentHashMap<>();
		map.put("1", "aaaaaa");
		map.put("2", "bbbbbb");
		new Thread(new MCurrentHashMap()).start();
		new Thread(new MCurrentHashMap()).start();
		Thread.sleep(2000);
		map.get("1");
		System.out.println("Main: " + n);
	}
	@Override
	public void run() {
		try {
			synchronized (n) {
				n += "1";
				System.out.println("int the thread: " + n);
				Thread.sleep(5000);
			}
			System.out.println("111111");
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
